home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / Kubuntu 8.10 / kubuntu-8.10-desktop-i386.iso / casper / filesystem.squashfs / var / lib / dpkg / info / acpid.preinst < prev    next >
Text File  |  2008-09-25  |  758b  |  30 lines

  1. #!/bin/sh
  2.  
  3. set -e
  4.  
  5.  
  6.  
  7. # Remove a no-longer used conffile
  8. rm_conffile() {
  9.     PKGNAME="$1"
  10.     CONFFILE="$2"
  11.     if [ -e "$CONFFILE" ]; then
  12.         md5sum="`md5sum \"$CONFFILE\" | sed -e \"s/ .*//\"`"
  13.         old_md5sum="`dpkg-query -W -f='${Conffiles}' $PKGNAME | sed -n -e \"\\\\' $CONFFILE '{s/ obsolete$//;s/.* //p}\"`"
  14.         if [ "$md5sum" != "$old_md5sum" ]; then
  15.             echo "Obsolete conffile $CONFFILE has been modified by you."
  16.             echo "Saving as $CONFFILE.dpkg-bak ..."
  17.             mv -f "$CONFFILE" "$CONFFILE".dpkg-bak
  18.         else
  19.             echo "Removing obsolete conffile $CONFFILE ..."
  20.             rm -f "$CONFFILE"
  21.         fi
  22.     fi
  23. }
  24. case "$1" in
  25.   install|upgrade)
  26.     rm_conffile acpid /etc/logrotate.d/acpid
  27.   ;;
  28. esac
  29.  
  30.